using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BUS;
using Entities;
using Utility;


public partial class Admin_SanPham_CapNhatTinhTrangGiaoHang : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            LoadData();
        }
    }
    private void LoadData()
    {
        try
        {
            int id = int.Parse(Request.QueryString["id"].ToString());
            tbTinhTrangGH tinhtrangGH = tbTinhTrangGHBUS.GetByID(id);
            if (tinhtrangGH != null)
            {
                txt_MaTinhTrangGH.Text = id.ToString();
                txt_TenTinhTrangGH.Text = tinhtrangGH.TenTT;
            }
        }
        catch
        {
            Response.Redirect("~/Admin/SanPham/DanhSachTinhTrangGiaoHang.aspx");
        }

    }
    protected void btn_luu_Click(object sender, EventArgs e)
    {
        try
        {
            tbTinhTrangGH tinhtrangGH = new tbTinhTrangGH();
            tinhtrangGH.MaTT = int.Parse(txt_MaTinhTrangGH.Text);
            tinhtrangGH.TenTT = txt_TenTinhTrangGH.Text;
            tbTinhTrangGHBUS.Update(tinhtrangGH);
        }
        catch
        {
            Response.Redirect("~/Admin/SanPham/DanhSachTinhTrangGiaoHang.aspx");
        }
        Response.Redirect("~/Admin/SanPham/DanhSachTinhTrangGiaoHang.aspx");
    }
}
